<!--<?php
include_once PrintEot('header');
if(empty($action) || $action=='list'){
print <<<EOT
-->
<form action="$admin_file" method="post" name="form">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="left" class="tittab">
                <strong>系统管理 &gt;&gt; 用户管理</strong>
            </td>
        </tr>
    </table>
    <table id="Table50" border="0" cellpadding="0" cellspacing="1" width="100%" align=center>
        <tr>
            <td align="right" valign="center">
                <table id="Table51" border="0" cellpadding="0" cellspacing="5" height="30">
                 <input id="Hidden1" name="allSelect" type="hidden" value="all" />
                    <tr>
                        <td align="middle" valign="center">
                            <a href="javascript:document.location.reload();">
                          <img align="absMiddle" border="0" height="15" src="$imgpath/admin/reserch.gif" style="text-decoration: underline" width="17" /><span style="color: #547054"> 刷新</span></a>
<!--
EOT;
						if($canadd==true){
							showButton(1,'新增',$admin_file.'&action=new'.$transtr);
						}
						if($candel==true){
							showButton(2,'删除','javascript:ConfirmDel("'.$admin_file.'&action=del'.$transtr.'&Page='.$curpage.'","此操作不可恢复,确认删除吗？");');
						}
print <<<EOT
-->
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="2">
            </td>
        </tr>
    </table>
    <div class="tab">
        <table id="Table52" border="0" cellpadding="3" cellspacing="0" align=center>
            <tr>
                <td align="middle" class="title" height="20" valign="center">序号</td>
                <td align="middle" class="title" height="20" valign="center">
                    <input id="Checkbox1" name="as" onclick="allchecked()" type="checkbox" />全选
                </td>
                <td align="middle" class="title" height="20" valign="center">登录名称</td>
                <td align="middle" class="title" height="20" valign="center">真实姓名</td>
                <td align="middle" class="title" height="20" valign="center">昵称</td>
                <td align="middle" class="title" height="20" valign="center">手机</td>
                <td align="middle" class="title" height="20" valign="center">QQ</td>
                <td align="middle" class="title" height="20" valign="center">MSN</td>               
                <td align="middle" class="title" height="20" valign="center">时间</td>
                <td align="middle" class="title" height="20" valign="center">状态</td>
                <td align="middle" class="title" height="20" valign="center">操作</td>
            </tr>
<!--
EOT;
$curidx = ($curpage-1)*$perpage;
$curpageidx = 0;
$showcount = count($db_sysuserlist); 
foreach($db_sysuserlist as $sysuser ){
		$curidx = $curidx+1;
		$curpageidx = $curpageidx+1;	
		$cdate = date('Y/m/d H:i:s',$sysuser[create_time]);
print <<<EOT
-->
            <tr height="30" onclick="SwitchTd(this,'click',$curpageidx);" onmouseout="SwitchTd(this,'out',$curpageidx);" onmouseover="SwitchTd(this,'over',$curpageidx);" style="cursor: hand">
                <td align="middle" valign="center">$curidx </td>
                <td align="middle" class="hei" valign="center"><input id="ids" name="ids" type="checkbox" value="$sysuser[id]" /></td>
                <td align="middle" valign="center">&nbsp;$sysuser[login_name]</td>
                <td align="middle" valign="center">&nbsp;$sysuser[real_name]</td>
                <td align="middle" valign="center">&nbsp;$sysuser[nick_name]</td>
                <td align="middle" valign="center">&nbsp;$sysuser[mobile]</td>
                <td align="middle" valign="center">&nbsp;$sysuser[qq]</td>                
                <td align="middle" valign="center">&nbsp;$sysuser[msn]</td>
                <td align="middle" valign="center">&nbsp;$cdate</td>
                <td align="middle" valign="center">&nbsp;
<!--
EOT;
	echo $cfg_adminstatus[$sysuser[is_active]];
print <<<EOT
-->                
                </td>
                <td align="middle" valign="center">&nbsp;
<!--
EOT;
	showEditButton($sysuser[id]);
print <<<EOT
-->
				&nbsp;
<!--
EOT;
	showDisString($sysuser[id]);
print <<<EOT
-->
                </td>
            </tr>
<!--
EOT;
}print <<<EOT
-->
        </table>
    </div>
    <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td>
                &nbsp;</td>
            <td align="right" height="35">
<!--
EOT;
	showPageBreakInfo($showcount);
print <<<EOT
-->
             &nbsp;</td>
        </tr>
    </table>
    <input type="hidden" id="count" name="count" value="$showcount" />
</form>
<!--
EOT;
}
if($action=="edit" || $action=="new"){
print <<<EOT
-->
<form name="form" action="$admin_file" method="post" onsubmit="return checkfrm();"> 
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="curid" value="$curid"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif"><strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 新增/编辑　管理用户</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="100%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="100%" border=0 align=center id="Table24">
        <tbody>
		 
        
        <tr>
			<td align=right width="25%">登录名称：</td>
			<td><input type="text" id="login_name" style="WIDTH: 261px" name="login_name" value="$db_sysuser[login_name]"/><font color="red">*</font></td>
		</tr>
		<tr>
			<td align=right>登录密码：</td>
			<td><input type="text" id="login_srcpwd" style="WIDTH: 261px" name="login_srcpwd" value="$db_sysuser[login_srcpwd]"/><font color="red">*</font></td>
		</tr>
		<tr>
			<td align=right>真实姓名：</td>
			<td><input type="text" id="real_name" style="WIDTH: 261px" name="real_name" value="$db_sysuser[real_name]"/><font color="red">*</font></td>
		</tr>
		<tr>
			<td align=right>昵称：</td>
			<td><input type="text" id="nick_name" style="WIDTH: 261px" name="nick_name" value="$db_sysuser[nick_name]"/><font color="red">*</font></td>
		</tr>
		<tr>
			<td align=right>QQ号码：</td>
			<td><input type="text" id="qq" style="WIDTH: 261px" name="qq" value="$db_sysuser[qq]"/></td>
		</tr>
		<tr>
			<td align=right>手机号：</td>
			<td><input type="text" id="mobile" style="WIDTH: 261px" name="mobile" value="$db_sysuser[mobile]"/><font color="red">*</font></td>
		</tr>
		<tr>
			<td align=right>MSN账号：</td>
			<td><input id="msn"  style="WIDTH: 261px" name="msn" value="$db_sysuser[msn]"/></td>
		</tr>
		<tr>
			<td align="right">状态：</td>
			<td>
<!--
EOT;
	if(isset($db_sysuser)==false || $db_sysuser[is_active]==0){
		echo '<input type="radio" id="is_active" name="is_active" value="0" checked/>停止';
	}else{
		echo '<input type="radio" id="is_active" name="is_active" value="0"/>停止</input>';
	}
	if(isset($db_sysuser) && $db_sysuser[is_active]==1){
		echo '<input type="radio" id="is_active" name="is_active" value="1" checked/>开通';
	}else{
		echo '<input type="radio" id="is_active" name="is_active" value="1"/>开通';
	}
print <<<EOT
-->
			</td>
		</tr>
		<tr>
			<td align="right">角色：</td>
			<td>
			    $selrolelist
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<input type="submit" id="btnSubmit" value=" 确定 " NAME="btnSubmit">
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="button" onclick="window.location='$admin_file$transtr';" value=" 取消 "/>
			</td>
		</tr>
         
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>

<script>
	function checkfrm(){
		if($('login_name').value == ""){
			alert('登录名称不能为空！');
			$('login_name').focus();
			return false;
		}
		if($('login_srcpwd').value == ""){
			alert('登录密码不能为空！');
			$('login_srcpwd').focus();
			return false;
		}		
		if($('real_name').value == ""){
			alert('真实姓名不能为空！');
			$('real_name').focus();
			return false;
		}
		if($('nick_name').value == ""){
			alert('昵称不能为空！');
			$('nick_name').focus();
			return false;
		}
		if($('mobile').value == ""){
			alert('手机号不能为空！');
			$('mobile').focus();
			return false;
		}		
		return true;
	}
</script>
<!--
EOT;
}else if($action=="dis"){
print <<<EOT
-->

<form name="form" action="$admin_file" method="post" id="form"> 
<input type="hidden" id="action" name="action" value="disave"/>
<input type="hidden" id="delflag" name="delflag" value="0"/>
<input type="hidden" id="curid" name="curid" value="$curid"/>
<input type="hidden" id="userName" name="userName" value="$userName"/>
<input type="hidden" id="ownIds" name="ownIds" value="$ownIds"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif"><strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 分配用户</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="100%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="98%" border=0 align=center id="Table24">
        <tbody>
		 
        <tr><td class=2 height=10></td></tr>
				<tr>
					<td width="10%" align=left height="25"><b>用户名：</b></td>
					<td><b><font color=red>$db_sysuser[login_name]</font></b>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="button" onclick="history.go(-1);" value=" 返回 "/>
					</td>
				</tr>
				<tr><td height=10></td></tr>
				<tr>
					<td align=left height="25"><b>下属用户：</b></td>
					<td>
						&nbsp;$ownUserList
					</td>
				</tr>
				<tr>
					<td colspan="2" align=center height="25">&nbsp;&nbsp;&nbsp;
<!--
EOT;
	if(!empty($ownUserList)){
		echo '<input type="submit" name="btnDelete" id="btnDelete" value=" 删除 "/>';
	}
print <<<EOT
 -->
						
					</td>
				</tr>
				
				<tr>
					<td align=left height="25"><b>添加下属用户：</b></td>
					<td align=left height="25">&nbsp;
						$notOwnUserList
					</td>
				</tr>
				<tr>
					<td colspan="2" height=25 align=center>&nbsp;&nbsp;&nbsp;
						<input type="submit" name="btnAdd" id="btnAdd" value=" 添加 "/>
					</td>
				</tr>
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>

<script type="text/jscript" language="javascript">
function SelectUser(){
	var UserID = event.srcElement.value;
	var UserList = ","+$("ownIds").value;
	if(UserList.indexOf(',' + UserID + ',') == -1)
		$("ownIds").value = UserList + UserID + ',';
	else
		$("ownIds").value = UserList.replace(',' + UserID + ',',',');
	if($("ownIds").value.substring(0,1)==",") $("ownIds").value = $("ownIds").value.substring(1);
}

function RemoveUser(){
	var UserID = event.srcElement.value;
	var UserList = $("ownIds").value;
	if((","+UserList).indexOf(',' + UserID + ',') >= 0)
		$("ownIds").value = (","+UserList).replace(',' + UserID + ',',',');		
	else
		$("ownIds").value = UserList + UserID + ',';
	if($("ownIds").value.substring(0,1)==",") $("ownIds").value = $("ownIds").value.substring(1);	
}
</script>

<!--
EOT;
}
?>-->

